﻿#include "console_log_appender.h"
#include "log_event.h"

#include <iostream>

#include <breaking/time/date.h>

namespace breaking
{
	console_log_appender::console_log_appender()
	{
	}

	console_log_appender::~console_log_appender()
	{
	}

	bool console_log_appender::do_open()
	{
		return true;
	}

	bool console_log_appender::do_append(const log_event& event)
	{
		date d(event.log_time);
		std::cout << "[" << d.to_string() << "][" << get_log_priority_name(event.priority) << "]";
		std::cout << event.message << std::endl;
		return true;
	}

	void console_log_appender::do_close()
	{
	}
}